package cn.mldn.producer.impl;

import cn.mldn.producer.IMessageProducerService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import static cn.mldn.config.ProducerConfig.EXCHANGE;
import static cn.mldn.config.ProducerConfig.ROUTING_KEY;

/**
 * description:
 * Created by gy on 2017/8/21.
 */
@Service
public class MessageProducerServiceImpl implements IMessageProducerService {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @Override
    public void sendMessage(String msg) {
        this.rabbitTemplate.convertAndSend(EXCHANGE,ROUTING_KEY,msg);
    }
}
